import os
import Image
import ImageDraw

    
if __name__ == "__main__":
    
#    path = '/Users/tpilanta/Documents/--Work--/B3/pol-annotation'
#    imgfile = os.path.join(path,'00001.jpg')
#    
#    img = Image.open(imgfile)
#    draw = ImageDraw.Draw(img)
#
#    """
#    These XY points are scaled. To use them, multiply them by 2. 
#    """
#
#
#    """ gravel (top left triangle) """
#    color1 = 'red'
#    draw.ellipse((0,0,5,5), fill=color1, outline=color1)
#    draw.ellipse((0,248,5,253), fill=color1, outline=color1)
#    draw.ellipse((244,0,249,5), fill=color1, outline=color1)
#    
#    draw.line([(0,0), (0,248)], fill=color1, width=1)
#    draw.line([(0,0), (244,0)], fill=color1, width=1)
#    draw.line([(0,248), (244,0)], fill=color1, width=1)
#    
#    """ top sidewalk """
#    color2 = 'green'
##    draw.ellipse((0,248,5,253), fill=color2, outline=color2)
#    draw.ellipse((0,294,5,299), fill=color2, outline=color2)
##    draw.ellipse((244,0,249,5), fill=color2, outline=color2)
#    draw.ellipse((285,0,290,5), fill=color2, outline=color2)
#
#    draw.line([(0,248), (244,0)], fill=color2, width=1)
#    draw.line([(0,294), (285,0)], fill=color2, width=1)
#    
#    """ bottom sidewalk """
#    color3 = 'yellow'
#    draw.ellipse((525,0,530,5), fill=color3, outline=color3)
#    draw.ellipse((109,540,114,543), fill=color3, outline=color3)
#    draw.ellipse((605,0,610,5), fill=color3, outline=color3)
#    draw.ellipse((365,540,370,543), fill=color3, outline=color3)
#    
#    draw.line([(525,0), (109,540)], fill=color3, width=1)
#    draw.line([(605,0), (365,540)], fill=color3, width=1)
#    
#    """ cross-walk """
#    color4 = 'blue'
#    draw.ellipse((70,221,75,226), fill=color4, outline=color4)
#    draw.ellipse((180,445,185,450), fill=color4, outline=color4)
#     
#    draw.line([(70,221), (180,445)], fill=color4, width=1) 
#    draw.line([(0,294), (109,540)], fill=color4, width=1) 
#    
#    """ building (bottom right)"""
#    draw.ellipse((720,0,725,5), fill=color1, outline=color1)
#    draw.ellipse((720,540,725,543), fill=color1, outline=color1)
#    
#    
#    img.save('/Users/tpilanta/Documents/--Work--/B3/pol-annotation/' + 'out_scaled.jpeg')           
#                
                

    path = '/Users/tpilanta/Documents/--Work--/B3/pol-annotation'
    imgfile = os.path.join(path,'5.jpg')
    
    img = Image.open(imgfile)
    draw = ImageDraw.Draw(img)

    """
    These XY points are scaled. To use them, multiply them by 2. 
    """


    """ gravel (top left triangle) """
    color1 = 'red'
    draw.ellipse((2*0,2*0,2*5,2*5), fill=color1, outline=color1)
    draw.ellipse((2*0,2*248,2*5,2*253), fill=color1, outline=color1)
    draw.ellipse((2*244,2*0,2*249,2*5), fill=color1, outline=color1)
    
    draw.line([(2*0,2*0), (2*0,2*248)], fill=color1, width=1)
    draw.line([(2*0,2*0), (2*244,2*0)], fill=color1, width=1)
    draw.line([(2*0,2*248), (2*244,2*0)], fill=color1, width=1)
    
    """ top sidewalk """
    color2 = 'green'
#    draw.ellipse((0,248,5,253), fill=color2, outline=color2)
    draw.ellipse((2*0,2*294,2*5,2*299), fill=color2, outline=color2)
#    draw.ellipse((244,0,249,5), fill=color2, outline=color2)
    draw.ellipse((2*285,2*0,2*290,2*5), fill=color2, outline=color2)

    draw.line([(2*0,2*248), (2*244,2*0)], fill=color2, width=1)
    draw.line([(2*0,2*294), (2*285,2*0)], fill=color2, width=1)
    
    """ bottom sidewalk """
    color3 = 'yellow'
    draw.ellipse((2*525,2*0,2*530,2*5), fill=color3, outline=color3)
    draw.ellipse((2*109,2*540,2*114,2*543), fill=color3, outline=color3)
    draw.ellipse((2*605,2*0,2*610,2*5), fill=color3, outline=color3)
    draw.ellipse((2*365,2*540,2*370,2*543), fill=color3, outline=color3)
    
    draw.line([(2*525,2*0), (2*109,2*540)], fill=color3, width=1)
    draw.line([(2*605,2*0), (2*365,2*540)], fill=color3, width=1)
    
    """ cross-walk """
    color4 = 'blue'
    draw.ellipse((2*70,2*221,2*75,2*226), fill=color4, outline=color4)
    draw.ellipse((2*180,2*445,2*185,2*450), fill=color4, outline=color4)
     
    draw.line([(2*70,2*221), (2*180,2*445)], fill=color4, width=1) 
    draw.line([(2*0,2*294), (2*109,2*540)], fill=color4, width=1) 
    
    """ building (bottom right)"""
    draw.ellipse((2*720,2*0,2*725,2*5), fill=color1, outline=color1)
    draw.ellipse((2*720,2*540,2*725,2*543), fill=color1, outline=color1)
    
    
#    """ street """
#    draw.ellipse((2*0,2*294,2*10,2*304),fill=color1, outline=color1)
#    draw.ellipse((2*285,2*0,2*295,2*10),fill=color1, outline=color1)
#    draw.ellipse((2*525,2*0,2*535,2*10),fill=color1, outline=color1)
#    draw.ellipse((2*109,2*540,2*119,2*550),fill=color1, outline=color1)
#    draw.ellipse((2*0,2*540,2*10,2*550),fill=color1, outline=color1)
    
    
#    # person box
#    draw.ellipse((400,0,410,10), fill = 'black', outline='black')
#    draw.ellipse((460,0,470,10), fill = 'black', outline='black')
#    draw.ellipse((460,90,470,100), fill = 'black', outline='black')
#    draw.ellipse((400,90,410,100), fill = 'black', outline='black')


    draw.ellipse((328,936,338,946), fill="yellow", outline="yellow")
    draw.ellipse((390,936,400,946), fill="yellow", outline="yellow")
    draw.ellipse((390,966,400,976), fill="yellow", outline="yellow")
    draw.ellipse((328,966,338,976), fill="yellow", outline="yellow")
    
    img.save('/Users/tpilanta/Documents/--Work--/B3/pol-annotation/' + 'out_non-scaled.jpeg')           
                
         
        
    
    
   
                
            
    
            
            
